# -*- coding:utf-8 -*-

from pymongo import MongoClient

client = MongoClient('127.0.0.1', 27017)
db = client["DouYin"]
collection = db["快手_用户"]
collection1 = db['快手_作品']

# myquery = { "user_id": 430810918 }
#
# for x in collection.find(myquery):
#     print(x)

# for x in collection1.find({}, {"_id": 0, "name": 1, "alexa": 1 }):
#     print(x)

for r in collection.find():
    db["快手_作品"].update_many({'user_id': r['user_id']},
                            {'$set':{'cityName': r['cityName'], 'user_text': r['user_text'],
                                     'verified': r['verified'],'fan': r['fan'],
                                     'follow': r['follow'], 'photo_public': r['photo_public'],
                                     'moment': r['moment'], 'atTab': r.get('atTab')}})


